package taskit.datastructures;

import java.util.LinkedList;

//@author A0087072A
public class Floating extends Task implements Comparable<Floating> {

	// class attributes
	private boolean priority;

	// constructors
	public Floating(String taskName, boolean priority) {
		super(taskName);
		this.priority = priority;
	}
	public Floating(String taskName, boolean priority, LinkedList<String> tags) {
		super(taskName, tags);
		this.priority = priority;
	}
	public Floating(String taskName) {
		super(taskName);
		priority = false;
	}

	public Floating(String name, boolean priority, Date completeDate, boolean complete, String memo, boolean lastAdded) {
		super(name, completeDate, complete, memo, lastAdded);
		this.priority = priority;
	}
	
	public Floating() {
	}
	// methods

	// setters
	/**
	 * Sets the priority in this instance of Floating, extends Task
	 * 
	 * @see Task
	 * @param newPriority
	 *            boolean to set the priority of this instance to.
	 * @return 0 if successful, 1 if failure Last modified: 13th March by joe
	 */
	public int setPriority(boolean newPriority) {
		try {
			this.priority = newPriority;
		} catch (Exception anyEx) {
			anyEx.printStackTrace();
			return 1;
		}
		return 0;
	}

	// getters
	public boolean isPriority() {
		return priority;
	}

	// compareTo

	@Override
	public int compareTo(Floating otherTask) {
		if (this.priority == true && otherTask.isPriority() == false) {
			return 1;
		} else if (this.priority == false && otherTask.isPriority() == true) {
			return -1;
		} else
			return 0;
	}

	/*
	 * public boolean equals (Floating otherTask) {
	 * if(this.compareTo(otherTask)==0) return true; else return false; }
	 */
}